Skip to content

Conversation

@harshitBhardwaj97
Copy link
Contributor

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Invalid line numbers were being referenced on the about/style page, under the "Reference Github Examples" section, causing either the code snippet to be missing, or showing incorrect and inconsistent code.
This PR fixes this issue, and displays consistent code snippets in all the translations.
Fixes #2006. As of now, I have used the following code snippet (with all the different language bindings) -

WebElement message = driver.findElement(By.id("message"));
message.getText();

If this needs to be changed, then kindly let me know. Also verified the fix on local server -

SeleniumDocumentation.2006Fix.mp4

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

Invalid line numbers were being referenced on the
about/style page, under the "Reference Github Examples" section,
causing either the code snippet to be missing,
or showing incorrect and inconsistent code. This PR fixes this
issue, and displays consistent code snippets in all the translations.
@netlify
Copy link

netlify bot commented Oct 18, 2024

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 99ec2d7

@qodo-merge-pro
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

2006 - Fully compliant

Fully compliant requirements:

  • Fix incorrect line numbers being referenced on the about/style page
  • Show consistent code snippets for all language bindings
  • Use the code snippet for capturing the message element and extracting its text
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Code Consistency
Verify that the updated code snippets are consistent across all language bindings and accurately represent the intended functionality.

Documentation Accuracy
Ensure that the updated line numbers in the gh-codeblock shortcodes correctly reference the intended code sections in the example files.

@qodo-merge-pro
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Enhancement
Update code block line numbers to ensure correct code snippets are displayed

Update the line numbers in the code block paths to reflect the correct lines in the
example files. This ensures that the correct code snippets are displayed in the
documentation.

website_and_docs/content/documentation/about/style.ja.md [175-190]

-{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L26-L27" >}}
-{{< gh-codeblock path="examples/python/tests/getting_started/first_script.py#L18-L19" >}}
-{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/FirstScript.cs#L25-L26" >}}
-{{< gh-codeblock path="examples/ruby/spec/getting_started/first_script.rb#L17-L18" >}}
-{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L22-L23" >}}
-{{< gh-codeblock path="examples/kotlin/src/test/kotlin/dev/selenium/getting_started/FirstScriptTest.kt#L31-L32" >}}
+{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L14-L15" >}}
+{{< gh-codeblock path="examples/python/tests/getting_started/first_script.py#L9-L10" >}}
+{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/FirstScript.cs#L14-L15" >}}
+{{< gh-codeblock path="examples/ruby/spec/getting_started/first_script.rb#L9-L10" >}}
+{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L11-L12" >}}
+{{< gh-codeblock path="examples/kotlin/src/test/kotlin/dev/selenium/getting_started/FirstScriptTest.kt#L16-L17" >}}
  • Apply this suggestion
Suggestion importance[1-10]: 7

Why:

7
Improve code block indentation for better readability and consistency

Adjust the indentation of the code blocks within the tabpane to improve readability
and consistency with the surrounding markdown structure.

website_and_docs/content/documentation/about/style.ja.md [214-224]

 {{< tabpane text=true >}}
 {{% tab header="Java" %}}
+1. Start the driver
+{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L12" >}}
+2. Navigate to a page
+{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L14" >}}
+3. Quit the driver
+{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L29" >}}
+{{% /tab %}}
+{{< /tabpane >}}
 
-1. Start the driver
-   {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L12" >}}
-2. Navigate to a page
-   {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L14" >}}
-3. Quit the driver
-   {{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L29" >}}
-   {{% /tab %}}
-   {{< /tabpane >}}
-
  • Apply this suggestion
Suggestion importance[1-10]: 7

Why:

7
Update line number references in code block paths to ensure correct code snippets are displayed

Consider updating the line numbers in the code block paths to reflect the current
line numbers in the example files. This ensures that the correct code snippets are
displayed in the documentation.

website_and_docs/content/documentation/about/style.en.md [175-190]

-{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L26-L27" >}}
-{{< gh-codeblock path="examples/python/tests/getting_started/first_script.py#L18-L19" >}}
-{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/FirstScript.cs#L25-L26" >}}
-{{< gh-codeblock path="examples/ruby/spec/getting_started/first_script.rb#L17-L18" >}}
-{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L22-L23" >}}
-{{< gh-codeblock path="examples/kotlin/src/test/kotlin/dev/selenium/getting_started/FirstScriptTest.kt#L31-L32" >}}
+{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScript.java#L[updated-line-numbers]" >}}
+{{< gh-codeblock path="examples/python/tests/getting_started/first_script.py#L[updated-line-numbers]" >}}
+{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/FirstScript.cs#L[updated-line-numbers]" >}}
+{{< gh-codeblock path="examples/ruby/spec/getting_started/first_script.rb#L[updated-line-numbers]" >}}
+{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L[updated-line-numbers]" >}}
+{{< gh-codeblock path="examples/kotlin/src/test/kotlin/dev/selenium/getting_started/FirstScriptTest.kt#L[updated-line-numbers]" >}}
  • Apply this suggestion
Suggestion importance[1-10]: 7

Why:

7
Clarify the purpose of setting text=true in the tabpane shortcode

Consider adding a brief explanation or comment about the purpose of setting
text=true in the tabpane shortcode to improve clarity for contributors.

website_and_docs/content/documentation/about/style.en.md [196-198]

 If you want your example to include something other than code (default) or html (from `gh-codeblock`),
-you need to first set `text=true`,
-then change the Hugo syntax for the `tab`to use `%` instead of `<` and `>` with curly braces:
+you need to first set `text=true` to enable Markdown rendering within the tab,
+then change the Hugo syntax for the `tab` to use `%` instead of `<` and `>` with curly braces:
  • Apply this suggestion
Suggestion importance[1-10]: 7

Why:

7

💡 Need additional feedback ? start a PR chat

Copy link
Member

@harsha509 harsha509 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @harshitBhardwaj97! I

Just a quick note for next time - I noticed that some formatting changes were included in the PR as well. To make the review process smoother, could you please ensure that only changes related to the PR are pushed. It would help a lot with the review

Thanks,
Sri

@harsha509 harsha509 merged commit 8d5ae7c into SeleniumHQ:trunk Oct 19, 2024
3 checks passed
selenium-ci added a commit that referenced this pull request Oct 19, 2024
fix : Invalid line numbers reference on style page

Invalid line numbers were being referenced on the
about/style page, under the "Reference Github Examples" section,
causing either the code snippet to be missing,
or showing incorrect and inconsistent code. This PR fixes this
issue, and displays consistent code snippets in all the translations.

Co-authored-by: Sri Harsha <[email protected]> 8d5ae7c
@harshitBhardwaj97
Copy link
Contributor Author

Thank you @harshitBhardwaj97! I

Just a quick note for next time - I noticed that some formatting changes were included in the PR as well. To make the review process smoother, could you please ensure that only changes related to the PR are pushed. It would help a lot with the review

Thanks, Sri

Welcome @harsha509. I use IntelliJ Idea, and in that I have enabled automatic formatting of files, upon save. I will disable that action for this project, or else if some other formatter is used, then please let me know. I will enable that to make sure the coding standards are maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Incorrect line numbers being referenced on about/style page

2 participants